<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

//权限验证
if( Role::init() == false ){
	exit('没有权限');
}

$db = new DB();

$id = isset($_GET['id']) ? intval($_GET['id']) : 0;

$sql = 'select id,title,code,orders from analytic_codes where id='.$id.' and is_del=1 limit 1';
$rs = $db->query($sql)->getOne();

if( $rs['id'] < 1 ){
	echo '<script>alert("参数有误！");window.history.go(-1);</script>';
	exit;
}

//查询列表
$analytic_codes_sql = 'select id,title from analytic_codes where is_del=1 order by orders desc,id asc';
$analytic_codes_rs = $db->query($analytic_codes_sql)->getAll();

require template('admin/analytic_code/edit_code');